package com.only4play.practice.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.only4play.codegen.support.constants.BaseEnum;

import java.util.Optional;

/**
 * @author mdy
 * * @date 2024/9/27
 */
public enum HandlerType implements BaseEnum<HandlerType> {

    HANDLED(1,"已处理"),

    NO_HANDLE(0,"未处理");

    ;

    HandlerType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    @EnumValue
    private Integer code;
    private String name;

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public static Optional<HandlerType> of(Integer code) {
        return Optional.ofNullable(BaseEnum.parseByCode(HandlerType.class, code));
    }

}
